<%--
  Created by IntelliJ IDEA.
  User: qiliping
  Date: 15/12/2
  Time: 上午10:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="paging" uri="paging-taglib" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>


<html>
<head>
    <title>${title}</title>
    <script>
        $(function(){
            $(".isrec > a").click(function(){
                var obj = $(this);
                var confr="";
                var isr = $(this).attr("isr");
                if(isr==1){
                    confr="确认要取消首页推荐吗?";
                }else{
                    confr="确认要首页推荐吗?";
                }
                if(confirm(confr)){
                    var aid = $(this).attr("aid");
                    $.ajax({
                        url:"/ajax/adviser_recommend_to_home",
                        type:"post",
                        data:{id:aid},
                        success:function(res){
                            if(res == 1) {
                                if (isr == 1) {
                                    obj.text("首页推荐");
                                    obj.attr("isr", "0");
                                } else {
                                    obj.text("取消首页推荐");
                                    obj.attr("isr", "1");
                                }
                            }
                        }
                    })
                }

            });
        })
    </script>
</head>
<body>
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            业务团队管理
            <small>${title}</small>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="fa fa-home"></i>
                <a href="${ctx}/main">
                    首页
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="${ctx}/adviser?type=${type}">
                    ${title}
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="#">
                    列表
                </a>
            </li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>
<!-- END PAGE HEADER-->
<!------内容区----->
<div class="main">
    <form action="${ctx}/adviser" method="get">
        <div class="row">
            <div class="col-md-12">
                <div class="search">
                    <div class="form-group">
                        <label class="control-label">姓名：</label>
                        <input type="text" name="q" value="${q}" class="form-control form-control-inline"/>
                    </div>

                    <span class="actions">
                        <input class="btn blue" type="submit" value="搜索"/>
                    </span>
                    <span class="actions">

                        <span class="field-validation-error">${message}</span>

                        <a href="${ctx}/adviser/add?type=${type}" class="btn green" >${add_btn_title}</a>
                    </span>
                    </div>
            </div>
        </div>

      <%--  <div class="row">
            <div class="col-md-12">
                <div class="text-right">
                    <div data-toggle="buttons" class="btn-group status-filter">
                        <label class="btn btn-default active">
                            <input type="radio" class="toggle" checked> 所有 </label>
                        <label class="btn btn-default">
                            <input type="radio" class="toggle"> 待审核 </label>
                        <label class="btn btn-default">
                            <input type="radio" class="toggle"> 已认证 </label>
                        <label class="btn btn-default">
                            <input type="radio" class="toggle"> 未通过 </label>
                    </div>
                </div>
            </div>
        </div>--%>

        <div class="row">
            <div class="col-md-12">
                <table class="table table-striped table-hover zqy-table zqy-table productsTable">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>姓名</th>
                        <th>所在机构</th>
                        <th>推荐等级</th>
                        <th>
                            <c:choose>
                                <c:when test="${type==0}">
                                    投资策略
                                </c:when>
                                <c:when test="${type==1}">
                                    研究领域
                                </c:when>
                            </c:choose>
                        </th>

                        <th>加入时间</th>
                        <th>状态</th>
                        <th></th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach var="item" items="${lists}">
                        <tr>
                            <td>${item.adviserId}</td>
                            <td class="infoCol">
                                <div class="imgBox"><img alt="" src="${item.adviserPic}"></div>
                                <div class="productInfo">
                                    <a target="_blank" href="">${item.adviserName}</a>
                                    <div class="time">
                                        <%--2014-11-19  10:21:45 发布--%>
                                    </div>
                                </div>
                            </td>

                            <td>${item.organization}</td>
                            <td>${item.adviserLevel}</td>
                            <td>${item.investmentStrategy}</td>
                            <%--<td>
                                <c:choose>
                                    <c:when test="${item.adiserType==0}">
                                        合作投顾
                                    </c:when>
                                    <c:when test="${item.adiserType==1}">
                                        投研专家
                                    </c:when>
                                </c:choose>
                            </td>--%>
                            <td>
                                <fmt:formatDate value="${item.joinTime}" pattern="yyyy-MM-dd"/>
                            </td>
                            <td>
                                <c:choose>
                                    <c:when test="${item.status==0}">
                                        待审核
                                    </c:when>
                                    <c:when test="${item.status==1}">
                                        正常
                                    </c:when>
                                    <c:when test="${item.status==2}">
                                        已取消
                                    </c:when>
                                </c:choose>

                            </td>
                            <td>
                                <a href="${ctx}/adviser/edit?id=${item.adviserId}">编辑</a>
                                <a href="${ctx}/adviser/delete?id=${item.adviserId}">删除</a>
                               <%-- <span class="isrec">
                                <c:choose>
                                    <c:when test="${item.isRecommend==1}">
                                        <a href="javascript:void(0);" aid="${item.adviserId}" isr="1">取消首页推荐</a>
                                    </c:when>
                                    <c:otherwise>
                                        <a href="javascript:void(0);" aid="${item.adviserId}" isr="0">首页推荐</a>
                                    </c:otherwise>
                                </c:choose>--%>
                                </span>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
                <div class="text-center">
                    <ul class="pagination">
                        <paging:paging pageIndex="${pageIndex}" totalPage="${totalPage}" href="${ctx}/adviser" htmlTag="li"></paging:paging>

                    </ul>
                </div>

            </div>
        </div>

    </form>
</div>
<!------[end]内容区----->

</body>
</html>